vcpkg_from_github(
    OUT_SOURCE_PATH SOURCE_PATH
    REPO m-kuhn/QtWebDAV
    REF "v${VERSION}"
    SHA512 a4025a36090fb84647eae8acea83df82cdb46a5254f7cd0dcbbf9dccbf9bdeb68c4cec47ae3c34f5a67590553a7c6c05bf0e632e44ab6a6d16435a6f6b0d6a74
    HEAD_REF main
)

list(APPEND QTWEBDAV_OPTIONS -DBUILD_WITH_QT6=True)
if(VCPKG_CROSSCOMPILING)
    list(APPEND QTWEBDAV_OPTIONS -DQT_HOST_PATH=${CURRENT_HOST_INSTALLED_DIR})
    list(APPEND QTWEBDAV_OPTIONS -DQT_HOST_PATH_CMAKE_DIR:PATH=${CURRENT_HOST_INSTALLED_DIR}/share)
endif()

vcpkg_cmake_configure(
    SOURCE_PATH "${SOURCE_PATH}"
    OPTIONS ${QTWEBDAV_OPTIONS}
)

vcpkg_cmake_install()

file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
